<?php

require_once 'include.php';

$state = $_GET["state"];
$target = $_GET["target"];

switch ($target) {
    case 'serviceEntry':
        $redirect_uri = 'http://wx.hui-dian.cn/serviceEntry.php';
        break;
}

$params = array('appid'=>$serverAppId, 
                'redirect_uri'=>$redirect_uri, 
                'response_type'=>'code', 
                'scope'=>'snsapi_base', 
                'state'=>$state);
				
$url = 'https://open.weixin.qq.com/connect/oauth2/authorize?' 
        . http_build_query($params) . '#wechat_redirect';

header("Location:".$url);
